#!/usr/bin/python
# -*- coding: UTF-8 -*-

import datetime
import os
import os.path


def uploadFile(fileName,fileContent):
    # 日期做文件夹
    dateFolder = datetime.datetime.now().strftime("%Y%m%d")
    # 判断目录是否存在，不存在则创建
    if not os.path.isdir(dateFolder):
        os.makedirs(dateFolder)
    fileObject = open(dateFolder+"/"+fileName, 'w')
    fileObject.write(fileContent)
    print (fileObject)

def readFile(dateFolder,fileName):
    if not os.path.isfile(dateFolder+"/"+fileName):
        return None
    f = open(dateFolder+"/"+fileName, 'r')
    fr = f.read()
    return fr